package main

import "fmt"

func main() {
	//如何删除slice中的元素
	courseSlice := []string{"go", "grpc", "mysql", "es", "gin"}
	fmt.Println(courseSlice[3:])
	myslice := append(courseSlice[:2], courseSlice[3:]...)
	fmt.Println(11, courseSlice) //【1】

	fmt.Println(myslice)

	fmt.Println(222, courseSlice) //【2】

	//复制slice
	courseSliceCopy2 := courseSlice[:]
	fmt.Println(courseSliceCopy2)

	var courseSliceCopy = make([]string, len(courseSlice))
	copy(courseSliceCopy, courseSlice)
	fmt.Println(courseSliceCopy)

	fmt.Println("-------------------------------")
	courseSlice[0] = "java"
	fmt.Println(courseSliceCopy2)
	fmt.Println(courseSliceCopy)
}
